home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 August
/
Macworld (1999-08).dmg
/
Shareware World
/
Info
/
For Developers
/
MADE 1.4.0
/
Essentials
/
Essential Shell.c
< prev
Wrap
C/C++ Source or Header
|
1999-05-26
|
3KB
|
120 lines
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* MADE - Macintosh Application Development Essentials */
/* --------------------------------------------------- */
/* (c) Sig Software, http://www.sigsoftware.com/ */
/* */
/* These files can only be used for experimental purposes. To obtain */
/* fully commented code, source code for the functions in Essential */
/* Extras.h and permission for usage in final projects, you must */
/* purchase a license. See documentation for more information. */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* Essential Shell.c */
/* ----------------- */
/* */
/* Application entry point, initialisations and Gestalt checking. */
/* */
/* Version 1.0.0 - 10th November 1996 */
/* Version 1.0.1 - 4th June 1997 - Fixed macro, function names */
/* Version 1.1.0 - 29th January 1998 - New OS function names */
/* Version 1.1.1 - 19th June 1998 - Casts for InitialiseMemory */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "Essential Headers.h"
#include "Essential Prototypes.h"
Boolean applicationHasQuit=false;
void* dummy;
void main()
{
Error error=0;
InitGraf(&qd.thePort);
InitFonts();
InitWindows();
InitMenus();
TEInit();
InitDialogs(0L);
InitCursor();
MoreMasters();
MaxApplZone();
#if Use_AppleEvents
if (CheckGestaltBit(gestaltAppleEventsAttr, gestaltAppleEventsPresent)) {
error=InitAppleEvents();
TestError(error);
#if Insist_On_AppleEvent_Support
_i(error)
#endif
} else {
#if Insist_On_AppleEvent_Support
TestError(System_Software_Version_Error);
_g
#endif
}
#endif
#if Use_Drag_Manager
if (CheckGestaltBit(gestaltDragMgrAttr, gestaltDragMgrPresent)) {
error=InitDragManager();
TestError(error);
#if Insist_On_Drag_Manager_Support
_i(error)
#endif
} else {
#if Insist_On_Drag_Manager_Support
TestError(System_Software_Version_Error);
_g
#endif
}
#endif
#if Project_Under_Development && Initialise_Allocated_Memory
dummy=(void*)NewPtr(MaxMem((Size*)&dummy));
if (dummy) {
InitialiseMemory((char*)dummy, GetPtrSize((Ptr)dummy));
DisposePtr((Ptr)dummy);
}
#endif
error=InitMenuBar();
TestError(error);
_i(error)
error=MyInitialiseApplication();
_i(error)
ExecutionBody();
_e
}
void ExecutionBody()
{
while (!applicationHasQuit)
MainEventLoop();
MyClearUpApplication();
ExitToShell();
}
Boolean CheckGestaltBit(OSType selector, char bit)
{
long response;
if (Gestalt(selector, &response))
return false;
else if (!(response&(1<<bit)))
return false;
else
return true;
}